package com.lagou.edu.dao;

import com.lagou.edu.pojo.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Repository;

import java.util.List;

@Component
public interface UserDao {

    @Select("SELECT * from `user`")
    List<User> getAll();

    @Select("SELECT * from `user` u WHERE u.email = #{email} AND u.password = #{password}")
    User getOneUser(String email,String password);

    @Select("SELECT * from `user` u WHERE u.id= #{id}")
    User getUserById(String id);

    @Insert("INSERT INTO `user` (id,email,`password`) VALUES (#{id},#{email},#{password})")
    void insertOneUser(User user);
}
